[PATCH] Revert "QProcessEnvironment: simplify locking"
authorMiao Wang <shankerwangmiao@gmail.com>
Wed, 21 Jan 2026 17:30:17 +0000 (01:30 +0800)
committerPino Toscano <pino@debian.org>
Sat, 2 May 2026 08:14:59 +0000 (10:14 +0200)
commitf32d6e774ad0bf2571f06b4a25e1e61dba69135d
tree943880b9685d45ee77464f60cdb29d8439995535
parent17a0b57750ff76e70edd05b746e07acd8733bec1
[PATCH] Revert "QProcessEnvironment: simplify locking"

This reverts commit c5d6b263c204cb09db2be36826e19acb03dc24fb.

The commit being reverted assumes the mutex is only protecting 'nameMap'
and nothing else is mutable, which is false. The mutex is not only
protecting 'nameMap' but also protecting the containing value objects,
since even though the value object is accessed read-only, its
implementation mutates its internal states for 2-way conversion between
ByteArray and QString.

Commit 85e61297f7b02297641826332dbdbc845a88c34b ("restore
QProcessEnvironment shared data thread safety on unix") said that
implicit sharing together with 'mutable' is a time bomb and the bomb is
triggered by the reverted commit.

Fixes: QTBUG-142938
Pick-to: 6.8
Change-Id: I9e3234f0eb2c691eccf753a11f63fae9944bd503
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 080d61c020678b75ed9d5acb062ec82ba8fc402f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 62917e4b518ecaa9dc34337e30f12eaeb41e790e)

Gbp-Pq: Name upstream_Revert-QProcessEnvironment-simplify-locking.patch
src/corelib/io/qprocess.cpp
src/corelib/io/qprocess_p.h
src/corelib/io/qprocess_unix.cpp